This invention relates to a 3-dimensional computer graphics system and in particular to methods and apparatus which reduce the number of times of modifying the data assigned to each pixel when rendering an image in such a system.
Tile based rendering systems are known. These break down an image to be rendered into a plurality of rectangular blocks or tiles. The way in which this is done and the subsequent texturing and shading performed is shown schematically in FIG. 1. This shows a geometry processing unit 2 which receives the image data from an application and transforms the data into screen space using a well-known method. The data is then supplied to a tiling unit 4, which inserts the screen space geometry into object lists for a set of defined rectangular regions, or tiles, 6. Each list contains primitives (surfaces) that exist wholly or partially in a sub-region of a screen (i.e. a tile). A list exists for every tile on the screen, although it should be borne in mind that some lists may have no data in them.
Data then passes tile by tile to a hidden surface removal unit 8 (HSR) and from there to a texturing and shading unit 10 (TSU). The HSR unit processes each primitive in the tile and passes to the TSU only data about visible pixels.
Many images comprise both opaque and translucent objects. In order to correctly render such an image, the HSR unit must pass “layers” of pixels which need to be shaded to the TSU. This is because more than one object will contribute to the image data applied to a particular pixel. For example the view from the inside of a building looking through a pane of dirty glass requires both the geometry visible through the glass, and then the pane of glass itself to be passed to the TSU. This process is referred to as “pass spawning”.
Typically, a tile based rendering device of the type shown in FIG. 1 will use a buffer to hold a tag for the frontmost object for each pixel in the tile currently being processed. A pass is typically spawned whenever the HSR unit 8 processes a translucent object, before the visibility test is performed. This results in all currently visible tags stored in the buffer followed by the visible pixels of the translucent object being sent to the TSU, i.e. more than one set of pixel data being passed for each pixel.
The flow diagram of FIG. 2 illustrates this approach. In this, a determination is made at step 12 as to whether or not a primitive being processed is opaque. If it is not, then the buffer of tags is sent to the TSU 10 at step 14. All visible tags for the non-opaque primitives are then also passed to the TSU at step 15. The HSR unit 8 will then move onto the next primitive at step 18. If the primitive is determined to be opaque at step 12, then its tags are written into the buffer at step 16 before moving onto the next primitive at step 18. The tag is a piece of data indicating which object is visible at a pixel. More than one tag per pixel is required when translucent objects cover opaque objects.
Use of the approach above means that opaque pixels that are not covered by translucent pixels, and are potentially obscured by further opaque objects may be passed to the TSU unnecessarily. In addition to this, a translucent object is passed to the TSU even if an opaque object subsequently obscures it.